<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03JS数据类型</title>
</head>
<body>
    <script>
        //JS数据类型=原始类型+引用类型
        //原始类型：number,string,boolean,null,undefined
        var a=1;
        var b=9.9;
        var c="hello";
        var d="你啊ho"
        var e=true;
        var f=null;
        //声明了变量但未赋值，会得到undefined，未定义型
        var g;
        console.log(g,typeof g)
        let obj={
            name:"张三",
            age:18,
            sex:"男"
        };
        console.log(obj,typeof obj);
        console.log(obj.name,obj.age);
        obj.age=20;
        console.log(obj);

        /*给对象动态新增一个like属性*/
        obj.like=["吃饭","睡觉","打豆豆"];
        console.log(obj);
        console.log(obj.play);//undefined 访问对象不存在的属性会得到undefined

        //JS数组
        let arr=['李逵','鲁班',1,2,false];
        console.log(arr,typeof arr);
        console.log(arr[0]);
        console.log(arr[4]);
        console.log(arr[999]);
    </script>
</body>
</html>